﻿using CSharpLearn_Chapter4.abc;
using CSharpLearn_Chapter4.Method;
using CSharpLearn_Chapter4.Struct;
using CSharpLearn_Chapter4.Class;
using MyNamespace;

namespace CSharpLearn_Chapter4
{
    internal class Program
    {
        static void Main(string[] args)
        {
            /*
            //定义StructTest的一个实例
            StructTest st = new StructTest();
            //调用方法
            st.TestStruct();
            */
            Class.Person p1 = new Class.Person("大海",20);
            Class.Person p2 = new Class.Person("高山", 21);
            Class.Person p3;

            Class.Person.SchoolName = "信息工程学院";

            Console.WriteLine($"学院：{Class.Person.SchoolName}");
            Console.WriteLine($"{p1.Name}的年龄{p1.Age}");
            Console.WriteLine($"{p2.Name}的年龄{p2.Age}");
            return;

            //Console.WriteLine("Hello, World!");
            //Console.WriteLine(b.Name);
            //Console.WriteLine(a.MAX_VALUE);
            /*
            foreach (string arg in args)
            {
               Console.WriteLine(arg);
            }
            Console.ReadLine();
            */
            //测试方法的值类型参数
            Console.WriteLine("测试方法的值类型参数");
            int x = 5;
            int y = 10;
            Console.Write("调用方法之前参数值：");
            Console.WriteLine($"x={x},y={y}");
            //引用ValueParam
            ValueParam v = new ValueParam();
            //调用方法
            Console.Write("调用方法：");
            v.Add(x, y);
            Console.Write("调用方法之后参数值：");
            Console.WriteLine($"x={x},y={y}");
            //按任意键结束

            //测试引用类型参数
            //定义数组并初始化
            int[] myArray = { 1, 3, 5, 7 };
            //打印数组元素
            Console.WriteLine("调用方法之前参数值：");
            foreach (int arg in myArray)
            {
                Console.WriteLine(arg);
            }
            //调用方法
            ReferenceParam r = new ReferenceParam();
            r.ModifyArray(myArray);

            //打印数组元素
            Console.WriteLine("调用方法之后参数值：");
            foreach (int arg in myArray)
            {
                Console.WriteLine(arg);
            }
            Console.ReadKey();

            //定义out参数
            int q, a;
            OutParam o = new OutParam();
            //调用方法
            o.Divide(x, y, out q, out a);

            //静态方法调用
            StaticMathodTest.Add(x, y);
            float area = (float)Math.PI * x * x;
            


        }


    }

    namespace abc
    {
        class a
        {
            public static int MAX_VALUE = 99;
            public static string Name = "cusx123";

            static int main()
            {
                Console.WriteLine("Hello, World,NI HAO!");
                Console.WriteLine(b.Name);
                Console.WriteLine(a.MAX_VALUE);
                return 0;
            }
        }
    }

}

namespace MyNamespace
{
    class b
    {
        public static string Name = "cusx";
        protected int i = 100;
    }
    class b1 : b
    {
        int y = 10;
        void main()
        {
            Console.WriteLine(y + i);
        }
    }
}
namespace MyNamespace
{
    class c
    {

    }
}

namespace N
{
    class A
    {
        global::A.B b;

    }
    class B
    {

    }
}
namespace A
{
    class B { }
}
